package fnord.illuminati.action.actions;

import fnord.illuminati.action.AttackModifierAction;
import fnord.illuminati.card.Alignment;
import fnord.illuminati.card.groupcards.ChineseCampaignDonors;
import fnord.illuminati.order.AttackOrder;
import fnord.illuminati.order.AttackType;

public class ChineseCampaignDonorsAction implements AttackModifierAction {
	private static final long serialVersionUID = 9474887012829930L;

	@Override
	public int doAttack(AttackOrder order) {
		if (order.getAttackType() == AttackType.CONTROL && order.getFrom() instanceof ChineseCampaignDonors) {
			int count = 0;
			for (Alignment a:order.getTo().getAlignments()) {
				if (a == Alignment.GOVERNMENT)
					count += 8;
				else if (a == Alignment.COMMUNIST)
					count -= 8;
			}
			return Math.max(count,0);
		}
		else
			return 0;
	}

	@Override
	public int doDefend(AttackOrder order) {
		return 0;
	}
}
